JBoss Community Archive (Read Only)

GateIn Portal 3.7

Wildcard (*) Membership Type

Wildcard (*) membership type is considered identical to ANY membership type.

If an user is assigned the * membership type for a group, when a membership type for this group and user is checked, then it is alway true regardless of the membership type.

Configuration and Initialization

The * membership can not be created at runtime via User Interface. It can only be initialized by configuration of OrganizationDatabaseInitializer plugin like the other membership types which will be created at the first starting time. Like following:

  <external-component-plugins>
    <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
    <component-plugin>
      <name>init.service.listener</name>
      <set-method>addListenerPlugin</set-method>
      <type>org.exoplatform.services.organization.OrganizationDatabaseInitializer</type>
      <description>this listener populate organization data for the first launch</description>
      <init-params>
        …
        <object-param>
          <name>configuration</name>
          <description>description</description>
          <object type="org.exoplatform.services.organization.OrganizationConfig">
            <field name="membershipType">
              <collection type="java.util.ArrayList">
                …
                <value>
                  <object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
                    <field name="type">
                      <string>*</string>
                    </field>
                    <field name="description">
                      <string>any membership type</string>
                    </field>
                  </object>
                </value>
                …
              </collection>
            </field>
            …
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

You could refer to Predefined User Configuration for more details of how to configure initial user data

API behavior changes

   To keep backward compatibility, we don't change behavior of existing methods in API, the * should be treated like before. Instead, we introduce a new method in GroupHandler interface to perform the wildcard * membership type resolution specifically:

Collection resolveGroupByMembership(String userName, String membershipType)

The method returns a collection of groups which the user has the specified membership type relationship or the * membership.

   In MembershipTypeHandler interface:

Collection findMembershipTypes()

It returns a collection of all membership types, and the "*" would be the first element if it exists  

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 13:12:01 UTC, last content change 2014-04-03 10:15:48 UTC.